package threading;

/**
 * @author krystal
 * @date 2022/11/23 11:20
 */
public class Demo13 {
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(()->{
//            for (int i = 0; i < 100000000; i++) {
//
//            }
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });
        //t开始之前，得到的就是NEW
        System.out.println(t.getState());
        t.start();

        //t正在工作，得到的是RUNNABLE
        Thread.sleep(50);
        System.out.println(t.getState());

        t.join();
        //t开始之后，得到的就是TERMINATED
        System.out.println(t.getState());
    }
}
